#pragma once

#ifndef _CORE_CORE_XML_HANDLER_MANAGER_H_
#define _CORE_CORE_XML_HANDLER_MANAGER_H_

#include <map>
#include <vector>

namespace ExamSystem
{
    class CCoreXMLHandler;
    class CStanzaHandler;
    
    /**************************************************************************\
     Component:     CCoreXMLHandlerManager
     Description:   
        This class create all CCoreXMLHandler instances. It also provides a 
        XML stanza dispatcher. Stanza handlers can register themselves with 
        corresponding package types. 
    \**************************************************************************/
    class CCoreXMLHandlerManager
    {
    public:
        CCoreXMLHandlerManager(void);
        ~CCoreXMLHandlerManager(void);

    public:
        // create a CCoreXMLHandler instance;
        CCoreXMLHandler *CreateHandler(void);

        // register a stanza handler. 
        void RegisterStanzaHandler(const std::string &type, CStanzaHandler *handler);

        // get the registered stanza handler 
        void GetStanzaHandler(const std::string &type, std::vector<CStanzaHandler *> &handlers) const;

    protected:
        std::multimap<std::string, CStanzaHandler *> m_registeredHandlers;
    };

}

#endif